<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%
    String path = request.getContextPath();//获取项目名称
%>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="keywords" content="keyword1,keyword2,keyword3">
    <meta name="description" content="this is my page">
    <meta name="content-type" content="text/html; charset=UTF-8">
    <link rel="stylesheet" href="/static/css/font.css">
    <link rel="stylesheet" href="/static/css/xadmin.css">
</head>
<body style="padding: 10px;background: white;min-height: 90%">
<div id="divvuehtml" style="width: 90%;height: 100%;margin: auto;">
    <form class="layui-form" id="add">
        <input type="hidden" name="id" v-model="userItems.id"/>
        <table class="layui-table" lay-size="sm">
            <thead>
            <tr>
                <th colspan="8" style="text-align: center;">修改学生体检信息</th>
            </tr>
            </thead>
            <tbody style="text-align: center;">

            <tr>
                <td>请选择学生名称</td>
                <td colspan="7">
                    <select name="stuId" v-model="userItems.stuId">
                        <option v-for="(s,index) in stu" :value="s.id">{{s.stuname}}</option>
                    </select>
                </td>
            </tr>

            <tr>
                <td>左眼视力</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.zysl" name="zysl"  placeholder="请输入左眼视力"  autocomplete="off" class="layui-input">
                </td>
                <td>右眼视力</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.yysl" name="yysl"  placeholder="请输入右眼视力"  autocomplete="off" class="layui-input">
                </td>
                <td>其他眼病</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.qtyb" name="qtyb"  placeholder="请输入其他眼病"  autocomplete="off" class="layui-input">
                </td>
                <td>色觉检查</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.sjjc" name="sjjc"  placeholder="请输入色觉检查"  autocomplete="off" class="layui-input">
                </td>
            </tr>

            <tr>
                <td>听力左</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.tlz" name="tlz"  placeholder="请输入听力左"  autocomplete="off" class="layui-input">
                </td>
                <td>听力右</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.tly" name="tly"  placeholder="请输入听力右"  autocomplete="off" class="layui-input">
                </td>
                <td>耳疾</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.rj" name="rj"  placeholder="请输入耳疾"  autocomplete="off" class="layui-input">
                </td>
                <td>嗅觉</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.xj" name="xj"  placeholder="请输入嗅觉"  autocomplete="off" class="layui-input">
                </td>
            </tr>


            <tr>
                <td>鼻窦疾病</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.bt" name="bt"  placeholder="请输入鼻窦疾病"  autocomplete="off" class="layui-input">
                </td>
                <td>颜面部</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.ymb" name="ymb"  placeholder="请输入颜面部"  autocomplete="off" class="layui-input">
                </td>
                <td>咽喉</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.yh" name="yh"  placeholder="请输入咽喉"  autocomplete="off" class="layui-input">
                </td>
                <td>唇</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.chun" name="chun"  placeholder="请输入唇"  autocomplete="off" class="layui-input">
                </td>
            </tr>

            <tr>
                <td>门齿</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.mc" name="mc"  placeholder="请输入门齿"  autocomplete="off" class="layui-input">
                </td>
                <td>眼科其他</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.yother" name="yother"  placeholder="请输入眼科其他"  autocomplete="off" class="layui-input">
                </td>
                <td>厘米</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.limi" name="limi"  placeholder="请输入厘米"  autocomplete="off" class="layui-input">
                </td>
                <td>千克</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.qk" name="qk"  placeholder="请输入千克"  autocomplete="off" class="layui-input">
                </td>
            </tr>

            <tr>
                <td>皮肤</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.pf" name="pf"  placeholder="请输入皮肤"  autocomplete="off" class="layui-input">
                </td>
                <td>淋巴</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.lb" name="lb"  placeholder="请输入淋巴"  autocomplete="off" class="layui-input">
                </td>
                <td>甲状腺</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.jzx" name="jzx"  placeholder="请输入甲状腺"  autocomplete="off" class="layui-input">
                </td>
                <td>脊柱</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.jz" name="jz"  placeholder="请输入脊柱"  autocomplete="off" class="layui-input">
                </td>
            </tr>

            <tr>
                <td>四肢</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.sz" name="sz"  placeholder="请输入四肢"  autocomplete="off" class="layui-input">
                </td>
                <td>关节</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.gj" name="gj"  placeholder="请输入关节"  autocomplete="off" class="layui-input">
                </td>
                <td>平拓足</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.ptz" name="ptz"  placeholder="请输入平拓足"  autocomplete="off" class="layui-input">
                </td>
                <td>外其他</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.wother" name="wother"  placeholder="请输入外其他"  autocomplete="off" class="layui-input">
                </td>
            </tr>

            <tr>
                <td>血压</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.xy" name="xy"  placeholder="请输入血压"  autocomplete="off" class="layui-input">
                </td>
                <td>心率</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.xl" name="xl"  placeholder="请输入心率"  autocomplete="off" class="layui-input">
                </td>
                <td>发育营养情况</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.fyyyqk" name="fyyyqk"  placeholder="请输入发育营养情况"  autocomplete="off" class="layui-input">
                </td>
                <td>神经精神科</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.sjjsk" name="sjjsk"  placeholder="请输入神经精神科"  autocomplete="off" class="layui-input">
                </td>
            </tr>

            <tr>
                <td>呼吸系统</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.hjxt" name="hjxt"  placeholder="请输入呼吸系统"  autocomplete="off" class="layui-input">
                </td>
                <td>心脏血管</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.xzxg" name="xzxg"  placeholder="请输入心脏血管"  autocomplete="off" class="layui-input">
                </td>
                <td>肝</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.gan" name="gan"  placeholder="请输入肝"  autocomplete="off" class="layui-input">
                </td>
                <td>脾</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.bi" name="bi"  placeholder="请输入脾"  autocomplete="off" class="layui-input">
                </td>
            </tr>

            <tr>
                <td>肾</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.shen" name="shen"  placeholder="请输入肾"  autocomplete="off" class="layui-input">
                </td>
                <td>内其他</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.nother" name="nother"  placeholder="请输入内其他"  autocomplete="off" class="layui-input">
                </td>
                <td>血</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.xue" name="xue"  placeholder="请输入血"  autocomplete="off" class="layui-input">
                </td>
                <td>肝功</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.gangong" name="gangong"  placeholder="请输入肝功"  autocomplete="off" class="layui-input">
                </td>
            </tr>

            <tr>
                <td>尿</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.niao" name="niao"  placeholder="请输入尿"  autocomplete="off" class="layui-input">
                </td>
                <td>胸部透视检查</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.xbts" name="xbts"  placeholder="请输入胸部透视检查"  autocomplete="off" class="layui-input">
                </td>
                <td>外貌异常</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.wmyc" name="wmyc"  placeholder="请输入外貌异常"  autocomplete="off" class="layui-input">
                </td>
                <td>口吃</td>
                <td>
                    <input type="text" lay-verify="required" v-model="userItems.kc" name="kc"  placeholder="请输入口吃"  autocomplete="off" class="layui-input">
                </td>
            </tr>

            <tr>
                <td>体检医院意见</td>
                <td colspan="7">
                    <textarea type="text" lay-verify="required" v-model="userItems.tjyyyj" name="tjyyyj"  placeholder="请输入体检医院意见"  autocomplete="off" class="layui-textarea"></textarea>
                </td>
            </tr>

            <tr>
                <td>体检结论</td>
                <td colspan="7">
                    <textarea type="text" lay-verify="required" v-model="userItems.tjjl" name="tjjl"  placeholder="请输入体检结论"  autocomplete="off" class="layui-textarea"></textarea>
                </td>
            </tr>

            <tr >
                <td colspan="8">
                    <button class="layui-btn layui-btn-normal" lay-submit lay-filter="formDemo">修改</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </td>
            </tr>
            </tbody>
        </table>
    </form>
</div>
</body>
<script src="/static/lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="/static/js/jquery.min.js"></script>
<script type="text/javascript" src="/static/js/xadmin.js"></script>
<script type="text/javascript" src="/static/js/vue.js"></script>
<script th:inline="none">
    var ve = new Vue({
        el: '#divvuehtml',//绑定vue渲染范围
        data: {
            userItems:{},
            stu:{}
        },created: function () {//vue在打开html也没初始化创建函数
            this.inin();//初始化数据
            this.ininstu();
        },mounted: function () {//初始化html完成后在进行操作
            setTimeout(function() {
                layui.use(['table','form','layer','upload','laydate'],function() {
                    var form = layui.form;
                    var layer = layui.layer;
                    var upload = layui.upload;
                    var laydate = layui.laydate;
                    //执行一个laydate实例
                    laydate.render({
                        elem: '#test1' //指定元素
                    });
                    //监听提交
                    form.on('submit(formDemo)', function(data){
                        var index;
                        $.ajax({
                            url : "/api/stutj/updates.do",
                            type : "POST",
                            data : data.field,
                            dataType : "json",
                            beforeSend : function(XMLHttpRequest) {
                                index = layer.msg('正在提交数据中，请稍候', {
                                    icon : 16,
                                    time : false,
                                    shade : 0.8
                                });
                            },success : function(data) {
                                if(data.success){
                                    // 刷新父页面
                                    layer.alert(data.msg, {
                                        icon : 6
                                    }, function() {
                                        xadmin.close();
                                        // 刷新父页面
                                        parent.location.reload();
                                    });
                                }else{
                                    xadmin.alert(data.msg,2)
                                }
                            },complete : function(XMLHttpRequest, textStatus) {
                                layer.close(index);
                            },error : function(data) {
                                layer.alert('网络异常或者数据错误', {
                                    icon : 2
                                });
                            }
                        });
                        return false;
                    });
                });
            },100)
        },methods: {//调用函数
            inin :function (){
                $.get("/api/stutj/getById.do",{"id":getUrlParam("id")},function(data){
                    if(data.success){
                        ve.userItems = data.data;
                    }else{
                        xadmin.alert(data.msg,{icon:2});
                    }
                },"json")
            },ininstu:function () {
                $.get("/api/student/list.do?page=1&rows=100",function(data){
                    if(data.success){
                        ve.stu = data.data.records;
                    }else{
                        xadmin.alert("初始化数据错误");
                    }
                },"json")
            }
        },updated: function () {
            layui.use(['form'], function(){
                var form = layui.form;
                form.render();
            })
        }
    })
    /**
     * 取得url参数
     */
    function getUrlParam(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); // 构造一个含有目标参数的正则表达式对象
        var r = window.location.search.substr(1).match(reg);  // 匹配目标参数
        if (r != null) return unescape(r[2]); return null; // 返回参数值
    }
</script>
</html>
